﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LogLib;

namespace PhotoUploader
{
    public partial class ucUploadInfoList : UserControl
    {
        public ucUploadInfoList()
        {
            InitializeComponent();
        }

        public void TakeLog(string strInfo)
        {
            try
            {
                if (lsbInfo.InvokeRequired)
                {
                    Action<string> outdelegate = new Action<string>(TakeLog);
                    this.BeginInvoke(outdelegate, new object[] { strInfo });
                    return;
                }
                lsbInfo.Items.Add(strInfo);
                lsbInfo.SelectedIndex = lsbInfo.Items.Count - 1;
                Log.WriteAsync(strInfo);
            }
            catch (System.Exception e)
            {
                Log.WriteException(e.ToString());
            }
        }
    }
}
